<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<base href="../../" />
		<script src="list.js"></script>
		<script src="page.js"></script>
		<link type="text/css" rel="stylesheet" href="page.css" />
	</head>
	<body>
		<h1>[name]</h1>

		<div class="desc">
			Create a AudioAnalyser object, which uses an [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode AnalyserNode]
			to analyse audio data.<br /><br />

			This uses the [link:https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API Web Audio API].

		</div>


		<h2>Example</h2>

		<div>[example:misc_sound misc / sound ]</div>
		<code>
		//Create an AudioListener and add it to the camera
		var listener = new THREE.AudioListener();
		camera.add( listener );

		// create an Audio source
		var sound = new THREE.Audio( listener );

		var audioLoader = new THREE.AudioLoader();

		//Load a sound and set it as the Audio object's buffer
		audioLoader.load( 'sounds/ambient.ogg', function( buffer ) {
			sound.setBuffer( buffer );
			sound.setLoop(true);
			sound.setVolume(0.5);
			sound.play();
		});

		//Create an AudioAnalyser, passing in the sound and desired fftSize
		var analyser = new THREE.AudioAnalyser( sound, 32 );

		//Get the average frequency of the sound
		analyser.getAverageFrequency();
		</code>


		<h2>Constructor</h2>


		<h3>[name]( audio, [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/fftSize fftSize] )</h3>
		<div>
		Create a new [page:AudioAnalyser AudioAnalyser].
		</div>


		<h2>Properties</h2>

		<h3>[property:AnalyserNode analyser]</h3>
		<div>An [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode AnalyserNode] used to analyze audio.</div>

		<h3>[property:Integer fftSize]</h3>
		<div>
		A non-zero power of two up to 2048, representing the size of the FFT (Fast Fourier Transform) to be used to determine the frequency domain.<br />
		See [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/fftSize this page] for details.
		</div>

		<h3>[property:Uint8Array data]</h3>
		<div>
		A Uint8Array with size determined by [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/frequencyBinCount analyser.frequencyBinCount]
		used to hold analysis data.
		</div>


		<h2>Methods</h2>


		<h3>[method:Uint8Array getFrequencyData]()</h3>
		<div>
		Uses the Web Audio's [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getByteFrequencyData getByteFrequencyData] method.
		See that page.
		</div>

		<h3>[method:Number getAverageFrequency]()</h3>
		<div>
		Get the average of the frequencies returned by the [page:AudioAnalyser.getFrequencyData getFrequencyData] method.
		</div>

		<h2>Source</h2>

		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
	</body>
</html>
